# Maintainer: David Runge <dvzrv@archlinux.org>
# Contributor: judd <jvinet@zeroflux.org>

pkgname=alsa-lib
pkgver=1.2.5.1
pkgrel=3
pkgdesc="An alternative implementation of Linux sound support"
arch=('x86_64')
url="https://www.alsa-project.org"
license=('LGPL2.1')
depends=('glibc' 'alsa-topology-conf' 'alsa-ucm-conf')
provides=('libasound.so' 'libatopology.so')
install="${pkgname}.install"
source=("https://www.alsa-project.org/files/pub/lib/${pkgname}-${pkgver}.tar.bz2"{,.sig})
sha512sums=('01998ffa449e925ff552c13aea47f9540903afdc533086067c78dcaba4d239c347180d3d28bb0000e6d19b7779c7249fcc77a30057930ca22d18ba55e163fa1c'
            'SKIP')
b2sums=('5464cc7f263bdf7b10aa7e1f542ad6dbc55bf300156fd1bded00375c41a518d4b14f96e28eb1c60a6ce7cc6e27da4b2e8598cd867f15417f260fc23513f93e11'
        'SKIP')
validpgpkeys=('F04DF50737AC1A884C4B3D718380596DA6E59C91') # ALSA Release Team (Package Signing Key v1) <release@alsa-project.org>

prepare() {
  cd "$pkgname-$pkgver"
  autoreconf -vfi
}

build() {
  cd "$pkgname-$pkgver"
  ./configure --prefix=/usr \
              --without-debug
  make
}

check() {
  cd "$pkgname-$pkgver"
  export LD_LIBRARY_PATH="${PWD}/src/.libs/:${LD_LIBRARY_PATH}"
  make -k check
}

package() {
  cd "$pkgname-$pkgver"
  make DESTDIR="$pkgdir" install
  make DESTDIR="$pkgdir" install -C doc
  install -vDm 644 {MEMORY-LEAK,TODO,NOTES,ChangeLog,doc/asoundrc.txt} \
    -t "${pkgdir}/usr/share/doc/${pkgname}"
}
